import { app } from "../app/App";
import { ToastAlertProxy } from "../proxy/ToastAlertProxy";
import { ToastLoadingProxy } from "../proxy/ToastLoadingProxy";
import { ToastNoticeProxy } from "../proxy/ToastNoticeProxy";
import { ToastTipsProxy } from "../proxy/ToastTipsProxy";
import { LayerEnum } from "../share/Enum";

export class ToastMgr {
    /**
     * 显示提示
     * @param msg 
     */
    showTips(msg: string) {
        app.ui.show(ToastTipsProxy, msg);
    }

    /**
     * 弹框提示
     * @param msg 
     * @param callback 
     * @param isShowCancel 
     */
    showAlert(msg: string, callback?: (isSure: boolean) => void, isShowCancel: boolean = false) {
        app.ui.show(ToastAlertProxy, {
            msg: msg,
            callback,
            showCancel: isShowCancel
        })
    }

    /**
     * 显示公告
     * @param msg 
     * @param times 
     */
    showNotice(msg: string, times: number = 1) {
        app.ui.show(ToastNoticeProxy, {
            msg,
            times
        })
    }

    /**
     * 显示loading
     */
    showLoading(msg: string = '', isMaskEvent: boolean = true) {
        app.ui.show(ToastLoadingProxy, {
            msg,
            isMaskEvent
        })
    }

}